လက်ရှိတည်နေရာ: ပင်မစာမျက်နှာ> ဖန်ရှင်အမျိုးအစားများ> property_exists

property_exists

အရာဝတ်ထုတစ်ခုသို့မဟုတ်အတန်းအစားသည်ဤပိုင်ဆိုင်မှုရှိ,
အမည်:property_exists
အမျိုးအစား:အတန်းများနှင့်အရာဝတ်ထု
programming language:php
တစ်ကြောင်းဖြင့်အကျဉ်းချုပ်:အရာဝတ်ထုတစ်ခုသို့မဟုတ်အတန်းအစားသတ်မှတ်ထားသော attribute ကိုရှိမရှိစစ်ဆေးသည်

function name: Property_exists ()

function ကိုဖော်ပြချက်: Monthent_exists () function ကို) အရာဝတ်ထုတစ်ခုသို့မဟုတ်အတန်းအစားသည်သတ်မှတ်ထားသော attribute ကိုရှိမရှိစစ်ဆေးသည်။

Parametermer

  • $ အတန်းအစား: လိုအပ်သည်။ class name သို့မဟုတ် check လုပ်ထားရန်အရာဝတ်ထု။
  • $ အိမ်ခြံမြေ: လိုအပ်သည်။ စစ်ဆေးရန် attribute ကိုအမည်။

Value ကိုပြန်သွားပါ

  • ပစ္စည်းဥစ်စာပိုင်ဆိုင်မှုတည်ရှိပြီးလက်လှမ်းမီလျှင်စစ်မှန်သောပြန်လာ။
  • အကယ်. ပစ္စည်းဥစ်စာပိုင်ဆိုင်မှုမရှိပါကသို့မဟုတ်လက်လှမ်းမမီနိုင်ပါကမှားယွင်းစွာပြန်လာသည်။

သက်ဆိုင်သောဗားရှင်း - PHP 4, PHP 5, PHP 7

အသုံးပြုမှုဥပမာ -

  1. အတန်းအစားသတ်မှတ်ထားသော attribute ကိုရှိမရှိစစ်ဆေးပါ။
 class MyClass { public $name = "John"; private $age = 25; } $object = new MyClass(); if (property_exists($object, 'name')) { echo "The 'name' property exists."; } else { echo "The 'name' property does not exist."; } // 输出:The 'name' property exists.
  1. အရာဝတ်ထုတွင်သတ်မှတ်ထားသော attribute ကိုရှိ, မရှိစစ်ဆေးပါ။
 class MyClass { public $name = "John"; private $age = 25; } $object = new MyClass(); if (property_exists($object, 'age')) { echo "The 'age' property exists."; } else { echo "The 'age' property does not exist."; } // 输出:The 'age' property does not exist.
  1. Class Name သည်သတ်မှတ်ထားသော static attribute ကိုရှိမရှိစစ်ဆေးပါ။
 class MyClass { public static $name = "John"; private static $age = 25; } if (property_exists('MyClass', 'name')) { echo "The 'name' static property exists."; } else { echo "The 'name' static property does not exist."; } // 输出:The 'name' static property exists.
  1. အတန်းအစားအမည်မှာသတ်မှတ်ထားသော static private attribute ကိုရှိမရှိစစ်ဆေးပါ။
 class MyClass { public static $name = "John"; private static $age = 25; } if (property_exists('MyClass', 'age')) { echo "The 'age' static property exists."; } else { echo "The 'age' static property does not exist."; } // 输出:The 'age' static property does not exist.
သက်ဆိုင်သောဖင်ခှ်ရှင်းများ
  • သတ်မှတ်ထားသောအတန်းများ၏အမည်များ၏အမည်များကိုရေးစပ် get_declared_classes

    get_declared_classes

    သတ်မှတ်ထားသောအတန်းမျ
  • အရာဝတ်ထုဂုဏ်သတ္တိများရေးထားသည့် assementive ခင်းကျင်းမှုကိုသင်ရေးရန်ပြန်သွားပါ get_object_vars

    get_object_vars

    အရာဝတ်ထုဂုဏ်သတ္တိမျာ
  • အရာဝတ်ထုရဲ့အတန်းအစားအမည်ကိုပြန်သွားပါ get_class

    get_class

    အရာဝတ်ထုရဲ့အတန်းအစား
  • အားလုံးသတ်မှတ်ထားသောစရိုက်များအားလုံးတစ်ခုခင်းကျင်းပြန်လာ get_declared_traits

    get_declared_traits

    အားလုံးသတ်မှတ်ထားသော
  • "နှောင်းပိုင်း static binding" အတန်းအစား၏အမည် get_called_class

    get_called_class

    "နှောင်းပိုင်းs
  • အတန်း၏ပုံမှန်ဂုဏ်သတ္တိများ၏ခင်းကျင်းပြန်လည်ရောက်ရှိ get_class_vars

    get_class_vars

    အတန်း၏ပုံမှန်ဂုဏ်သတ္
  • ၎င်းသည် (array) $ အရာဝတ်ထုအဖြစ် (array) $ အရာဝတ်ထုအဖြစ်ပြန်လည်ရောက်ရှိပေမယ့် overloaded ခင်းကျင်း (arrayobject မှအသုံးပြုအဖြစ်) လျစ်လျူရှု။ output သည် get_object_vars () နှင့်ဆင်တူသည်, သို့သော်၎င်းသည်ကာကွယ်ထားသောနှင့်ပုဂ္ဂလိကလယ်ကွင်းများကိုလည်းပြသသည် get_mangled_object_vars

    get_mangled_object_vars

    ၎င်းသည်(array)$အရာဝတ
  • အဆိုပါ interface ကိုသတ်မှတ်မရှိမရှိစစ်ဆေးပါ interface_exists

    interface_exists

    အဆိုပါinterfaceကိုသတ